import request from '@/utils/request'

export default {
    //用户列表
    userList(condition) {
        return request({
            url: `/admin/users`,
            method: 'get',
            params: condition
        })
    },
    //禁用用户
    banUser(user) {
        return request({
            url: `/admin/user/disable`,
            method: 'put',
            data: user
        })
    },
    // 编辑角色
    editRole(user) {
        return request({
            url: `/admin/user/role`,
            method: 'put',
            data: user
        })
    },
    // 查询角色
    roleList() {
        return request({
            url: `/admin/user/role`,
            method: 'get',
        })
    },
    //更新用户信息
    updateUserInfo(user){
        return request({
            url: `/user/info`,
            method: 'put',
            data: user
        })
    },
    //更新用户信息
    userPassword(user){
        return request({
            url: `/users/password`,
            method: 'post',
            data: user
        })
    },
    //更新用户信息
    adminPassword(user){
        return request({
            url: `/admin/user/password`,
            method: 'post',
            data: user
        })
    },
    //在线用户
    onlineUserList(param){
        return request({
            url: `/admin/users/online`,
            method: 'get',
            params: param
        })
    },
    //下线用户
    removeOnlineUser(userInfoId){
        return request({
            url: `/admin/users/${userInfoId}/online`,
            method: 'delete',
        })
    },
}